package C

import rx.Observable


fun main(args: Array<String>) {

    val observable = Observable.create(Observable.OnSubscribe<String> { t ->
        for (i in 0..3)
            t.onNext(i.toString())
        t.onCompleted()
    })
    val cacheObservable = observable.cache()

    observable.subscribe({
        println(it)
    })

    println("=================divide==================")
    cacheObservable.subscribe({
        println(it)
    })

    println("=================divide==================")

    cacheObservable.subscribe({
        println(it)
    })
}